<template>
  	<div id="name">
    	<div class="wl-body">
      		<div class="bdds">
        		<div class="zc-top topbox slideOut">
          			<div>
						<div class="txtsde txtc t-left m-1 slideOut">
							{{ $t("m.zzhzczh") }}(USDT)
						</div>
            			<div class="wl-ptsh-txt slideOut">
							<countTo
								v-if="see"
								:startVal="0"
								:decimals="4"
								:endVal="Number(myze)"
								:duration="2000"
							></countTo>
              				<span v-else>******</span>
            			</div>
						<div class="txtc t-left slideOut">
							≈{{ sdw }}{{ see ? (s ? myzezh.toFixed(2) : "0") : "*****" }}
						</div>
          			</div>
					<div
						@click="tosee"
						class="tr-see"
						:class="see ? 'see' : 'nosee'"
					></div>
        		</div>
        		<div>
					<div class="mtp slink" :class="[ acchange == 0 ? 'topchanger' : '', acchange == 1 ? 'topchanger2' : '', ]" >
						<div class="xks scllow" :class="[acchange == 0 ? 'active' : '']" @click="goto('zc')" >
							{{ $t("m.yezh") }}
						</div>
            			<div class="xks scllow" :class="[acchange == 1 ? 'active' : '']" @click="goto('sy')" >
              				{{ $t("m.syzh") }}
            			</div>
          			</div>
        		</div>

        		<!-- <div class="mtpo slink xuankuang" v-if="acchange == 1">
					<div class="xksr scllow" :class="[acchangew == 0 ? 'active' : '']" @click="changersw(0)" >
            			{{ $t("m.wksy") }}
          			</div>
          			<div class="xksz scllow" :class="[acchangew == 1 ? 'active' : '']"  @click="changersw(1)" >
            			{{ $t("m.tjsy") }}
          			</div>
          			<div class="xksl scllow" :class="[acchangew == 2 ? 'active' : '']" @click="changersw(2)" >
            			{{ $t("m.jdfh") }}
          			</div>
          			<div class="xksl scllow" :class="[acchangew == 3 ? 'active' : '']" @click="changersw(3)" >
            			{{ $t("m.cbfh") }}
          			</div>
        		</div> -->

        		<div class="m-2 bottmls slideIn" v-if="acchangew == 0">
          			<div class="txtsde txtc t-left m-1">{{ $t("m.wksyzczh") }}(USDT)</div>
					<div class="wl-ptsh-txt">
						{{ see ? (s ? (s.winFt * ttou).toFixed(4) : "0") : "*****" }}
					</div>
					<div class="txtc t-left">
						≈{{ sdw }}{{ see ? (s ? (s.winFt * ttoc).toFixed(2) : "0") : "*****" }}
					</div>
        		</div>
        		<div class="m-2 bottmls slideIn" v-if="acchangew == 1">
          			<div class="txtsde txtc t-left m-1">{{ $t("m.tjsyzczz") }}(USDT)</div>
					<div class="wl-ptsh-txt">
						{{ see ? (s ? tjsy.toFixed(4) : "0") : "*****" }}
					</div>
					<div class="txtc t-left">
						≈{{ sdw }}{{ see ? (s ? tjsyzh.toFixed(2) : "0") : "*****" }}
					</div>
        		</div>
        		<div class="m-2 bottmls slideIn" v-if="acchangew == 2">
          			<div class="txtsde txtc t-left m-1">{{ $t("m.jdfhzczh") }}(USDT)</div>
          			<div class="wl-ptsh-txt">
            			{{ see ? s ? (s.gainpacketFtAmount * ttou).toFixed(4) : "0" : "*****" }}
          			</div>
          			<div class="txtc t-left">
            			≈{{ sdw }}{{ see ? s ? (s.gainpacketFtAmount * ttoc).toFixed(2) : "0" : "*****" }}
          			</div>
        		</div>
        		<div class="m-2 bottmls slideIn" v-if="acchangew == 3">
          			<div class="txtsde txtc t-left m-1">{{ $t("m.cbfhzczh") }}(USDT)</div>
					<div class="wl-ptsh-txt">
						{{ see ? (s ? (s.cashAmount * ttou).toFixed(4) : "0") : "*****" }}
					</div>
					<div class="txtc t-left">
						≈{{ sdw }}{{ see ? (s ? (s.cashAmount * ttoc).toFixed(2) : "0") : "*****" }}
					</div>
        		</div>

        		<div>
          			<div v-if="acchangew == 0" class="slideIn">
            			<div class="link-item bottmls">
              				<div class="zc-dj t-left">TROT</div>
							<div class="slink defcf">
								<div class="flex1">{{ $t("m.dqwkzl") }}</div>
								<div class="flex1">{{ $t("m.sfxs") }}</div>
							</div>
              				<div class="slink u-dj">
								<div class="flex1">
									{{ see ? (s ? s.winFt.toFixed(4) : "0") : "*****" }}
								</div>
								<div class="flex1">
									{{ see ? s ? Number(s.releaseRatio * 100).toFixed(2) + "%" : "0%" : "*****" }}
								</div>
              				</div>
            			</div>
            			<div class="link-item bottmls" @click="goto('kcsf')">
              				<div class="zc-dj t-left">TROT</div>
							<div class="slink defcf">
								<div class="flex1">{{ $t("m.jsrf") }}</div>
								<div class="flex1">{{ $t("m.ljsf") }}</div>
							</div>
              				<div class="slink u-dj">
								<div class="flex1">
									{{ see ? (jrsf ? jrsf.toFixed(4) : "0") : "*****" }}
								</div>
								<div class="flex1">
									{{ see ? (s ? s.releaseTotal.toFixed(4) : "0") : "*****" }}
								</div>
              				</div>
              				<div class="zc-r"><img src="../assets/timg/r.png" alt="" /></div>
            			</div>
          			</div>

          			<div v-if="acchangew == 1" class="slideIn">
            			<div class="link-item bottmls" @click="goto('wdtj')">
              				<div class="zc-dj t-left">{{ $t("m.wdtj") }}</div>
							<div class="slink defcf">
								<div class="flex1">{{ $t("m.ztrs") }}</div>
								<div class="flex1">{{ $t("m.tdrs") }}</div>
							</div>
              				<div class="slink u-dj">
                				<div class="flex1">
                  					<!-- {{ see ? s.recommendCount + "(" + $t("m.zongs") + ") / " + s.recommendValidCount + "(" + $t("m.youx") + ")" : "*****" }} -->
									{{see?s.recommendCount+`(${$t("m.zongs")})/${s.recommendValidCount}(${$t("m.youx")})`:"*****"}}			
                				</div>
                				<div class="flex1">
                  					{{see ? s.teamNum + "(" + $t("m.zongs") + ") / " + s.teamValidNum + "(" + $t("m.youx") + ")" : "*****" }}
                				</div>
              				</div>
              				<div class="zc-r"><img src="../assets/timg/r.png" alt="" /></div>
            			</div>
            			<div class="link-item bottmls" @click="goto('ztsy')">
              				<div class="zc-dj t-left">{{ $t("m.ztsy") }}</div>
							<div class="slink defcf">
								<div class="flex1">USDT</div>
								<div class="flex1">TROT</div>
							</div>
              				<div class="slink u-dj">
								<div class="flex1">
									{{ see ? (s ? s.recommendCnyAmount.toFixed(4) : "0") : "*****" }}
								</div>
                				<div class="flex1">
                  					{{ see ? (s ? s.recommendFtAmount.toFixed(4) : "0") : "*****" }}
                				</div>
              				</div>
              				<div class="zc-r"><img src="../assets/timg/r.png" alt="" /></div>
            			</div>
            			<div class="link-item bottmls" @click="goto('jtsy')">
              				<div class="zc-dj t-left">{{ $t("m.jtsy") }}</div>
							<div class="slink defcf">
								<div class="flex1">USDT</div>
								<div class="flex1">TROT</div>
							</div>
              				<div class="slink u-dj">
								<div class="flex1">
									{{ see ? (s ? s.teamCnyAmount.toFixed(4) : "0") : "*****" }}
								</div>
								<div class="flex1">
									{{ see ? (s ? s.teamFtAmount.toFixed(4) : "0") : "*****" }}
								</div>
              				</div>
              				<div class="zc-r"><img src="../assets/timg/r.png" alt="" /></div>
            			</div>
            			<div class="link-item bottmls" @click="goto('sqfh')">
              				<div class="zc-dj t-left">{{ $t("m.sqfh") }}</div>
							<div class="slink defcf">
								<div class="flex1">{{ $t("m.sqdj") }}</div>
								<div class="flex1">USDT</div>
							</div>
              				<div class="slink u-dj">
                				<div class="flex1">
                  					{{ see ? s ? s.userLevel != -1 ? "T" + s.userLevel : $t("m.tyyh") : "" : "*****" }}
                				</div>
								<div class="flex1">
									{{ see ? (s ? s.teamCnyAmount.toFixed(4) : "0") : "*****" }}
								</div>
              				</div>
              				<div class="zc-r"><img src="../assets/timg/r.png" alt="" /></div>
            			</div>
          			</div>
          			<div v-if="acchangew == 2" class="slideIn">
            			<div class="link-item bottmls" @click="goto('jdfh')">
              				<div class="zc-dj t-left">{{ $t("m.jdfhze") }}</div>
							<div class="slink defcf">
								<div class="flex1">TROT</div>
								<div class="flex1">{{ $t("m.zh") }}({{ bzdw }})</div>
							</div>
              				<div class="slink u-dj">
                				<div class="flex1">
									{{ see ? (s ? s.gainpacketFtAmount.toFixed(4) : "0") : "*****" }}
								</div>
                				<div class="flex1">
									{{ see ? s ? (s.gainpacketFtAmount * ttoc).toFixed(2) : "0" : "*****" }}
								</div>
              				</div>
              				<div class="zc-r"><img src="../assets/timg/r.png" alt="" /></div>
            			</div>
          			</div>
          			<div v-if="acchangew == 3" class="slideIn">
            			<div class="link-item bottmls" @click="goto('cbfh')">
              				<div class="zc-dj t-left">{{ $t("m.cbfhze") }}</div>
							<div class="slink defcf">
								<div class="flex1">TROT</div>
								<div class="flex1">{{ $t("m.zh") }}({{ bzdw }})</div>
							</div>
              				<div class="slink u-dj">
								<div class="flex1">
									{{ see ? (s ? s.cashAmount.toFixed(4) : "0") : "*****" }}
								</div>
								<div class="flex1">
									{{ see ? (s ? (s.cashAmount * ttoc).toFixed(2) : "0") : "*****" }}
								</div>
              				</div>
              				<div class="zc-r"><img src="../assets/timg/r.png" alt="" /></div>
            			</div>
          			</div>
        		</div>
      		</div>
    	</div>
  	</div>
</template>

<script>
import countTo from "vue-count-to";
export default {
  name: "name",
  data() {
    return {
      isPublish: false,
      sees: true,
      jrsf: 0,
      yc: false,
      acchange: 1,
      acchangew: sessionStorage.getItem("i") || 0,
      s: "",
      min: "",
    };
  },
  components: { countTo },
  created() {
    this.s = JSON.parse(sessionStorage.getItem("s"));
    setTimeout(() => {
      this.getdata();
    }, 1000);
  },
  computed: {
    see() {
      if (this.$store.getters.see == "1") {
        return true;
      } else {
        return false;
      }
    },
    ttoc() {
      return this.$store.getters.ttoc;
    },
    utoc() {
      return this.$store.getters.utoc;
    },
    ttou() {
      return this.$store.getters.ttou;
    },
    bzdw() {
      if (this.$store.getters.language == "zh-CN") {
        return "CNY";
      } else {
        return "USD";
      }
    },
    sdw() {
      if (this.$store.getters.language == "zh-CN") {
        return "￥";
      } else {
        return "$";
      }
    },
    myze() {
      if (this.s) {
        var a =
          this.s.trxAmount +
          this.s.ftAmount * this.ttou +
          this.s.winFt * this.ttou;
        return a;
      } else {
        return 0;
      }
    },
    myzezh() {
      if (this.s) {
        var a = this.s.trxAmount * this.utoc + this.s.ftAmount * this.ttoc;
        return a;
      } else {
        return 0;
      }
    },
    tjsy() {
      if (this.s) {
        var a =
          this.s.teamCnyAmount +
          this.s.recommendCnyAmount +
          (this.s.teamFtAmount +
            this.s.recommendFtAmount +
            this.s.gainpacketFtAmount) *
            this.ttou;
        return a;
      } else {
        return 0;
      }
    },
    tjsyzh() {
      if (this.s) {
        var a =
          (this.s.teamCnyAmount + this.s.recommendCnyAmount) * this.utoc +
          (this.s.teamFtAmount +
            this.s.recommendFtAmount +
            this.s.gainpacketFtAmount) *
            this.ttoc;
        return a;
      } else {
        return 0;
      }
    },
  },
  mounted() {
    if (window.history && window.history.pushState) {
      history.pushState(null, null, document.URL);
      window.addEventListener("popstate", this.goBack, false);
    }
  },
  destroyed() {
    window.removeEventListener("popstate", this.goBack, false);
  },
  methods: {
    goBack() {
      sessionStorage.removeItem("i");
      this.$router.replace({ path: "/" });
    },
    changers(val) {
      this.acchange = val;
    },
    changersw(val) {
      this.acchangew = val;
      sessionStorage.setItem("i", val);
    },
    tosee() {
      this.sees = !this.sees;
      if (this.sees) {
        this.$store.commit("see", 1);
      } else {
        this.$store.commit("see", 0);
      }
    },
    goto(val) {
      this.$router.push({ path: val });
    },
    getdata() {
      let datas = {
        params: {
          address: this.$store.getters.userWallet,
        },
      };
      this.$get({
        url: "wms-wallet/getWallet",
        data: datas,
        callback: (data) => {
          this.$nextTick(function () {
            this.s = data.data;
            if (this.s) {
              this.$store.commit("nameid", this.s.id);
              this.$store.commit("s", this.s);
              this.getjrfs();
            }
          });
        },
      }).catch(() => {
        this.$toast(this.$i18n.t("m.errordata"));
      });
    },
    getjrfs() {
      var datas = {
        params: {
          uid: this.$store.getters.nameid,
          pageSize: 1,
          pageNum: 1,
          type: 1,
        },
      };
      this.$get({
        url: "wms-wallet-release/getList",
        data: datas,
        callback: (data) => {
          this.$nextTick(function () {
            var list = data.data;
            if (list[0]) {
              this.jrsf = list[0].releaseNum;
            } else {
              this.jrsf = 0;
            }
          });
        },
      }).catch(() => {
        this.$toast(this.$i18n.t("m.errordata"));
      });
    },
  },
};
</script>

<style lang="scss" scoped>
</style>